<template>
    <div class="teacherWork">
        <el-breadcrumb separator="/" class="breadcrumb-bottom">
            <el-breadcrumb-item :to="{ path: '/' }">统计分析</el-breadcrumb-item>
            <el-breadcrumb-item>教学工作量统计</el-breadcrumb-item>
        </el-breadcrumb>
        <el-form :model="teacherWorkForm" :rules="rules" ref="teacherWorkForm" label-width="0px">
                <el-row :gutter="20">
                <el-col :span="6">
                    <el-form-item prop="">
                    <el-input v-model="teacherWorkForm.term" placeholder="请输入学期"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item prop="">
                    <el-input v-model="teacherWorkForm.year" placeholder="请输入学年"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="2" class="overflow-clear">
                    <el-button type="primary" @click="submitForm('teacherWorkForm')" class="float-right">立即搜索</el-button>
                </el-col>
                </el-row>
        </el-form>
        <hr/>
        <div>
            <el-button-group style="margin-bottom:4px;" class="float-right">
            <el-button type="primary">导出</el-button>
            <el-button type="primary">打印</el-button>
            </el-button-group>
        </div>
         <el-table
        :data="studentTable"
        border
        style="width: 100%">
        <el-table-column
          prop="studentId"
          label="序号"
          width="180">
        </el-table-column>
        <el-table-column
          prop="studentName"
          label="教师编号"
          width="180">
        </el-table-column>
        <el-table-column
          prop="studentSex"
          label="教师姓名"
          width="180">
        </el-table-column>
        <el-table-column
          prop="classId"
          label="上课时长"
          width="180">
        </el-table-column>
        <el-table-column
          prop="studentJob"
          label="课程设计"
          width="180">
        </el-table-column>
        <el-table-column
          prop="studentPhoto"
          label="毕业设计"
          width="180">
        </el-table-column>
        <el-table-column
          prop="studentPhoto"
          label="总工作量"
          width="180">
        </el-table-column>
        <el-table-column
          label="详情">
          <template scope="scope">
            <router-link to="/StudentPersonInfo"><i class="el-icon-edit"></i></router-link>
            <router-link to="" @click.native.prevent="deleteRow(scope.$index, studentTable)"><i class="el-icon-delete"></i></router-link>
          </template>
        </el-table-column>
      </el-table>
    </div>
</template>
<script>

    export default{
        name: 'teacherWork',
        data(){
            return{
                teacherWorkForm:{
                    term:'',
                    year:''
                },
                studentTable:[],
            
            }
        },
        components:{
            
        },
        mounted:function(){
            this.$nextTick(function(){
              this.res();
            })
        },
        methods:{
              res:function(){
                // GET /someUrl
                this.$http.get('/static/data.json').then(response => {
                  // get body data
                  for (const element of response.body.studentData){
                      //push to tableData[]
                      this.studentTable.push(element);
                  }
                }, response => {
                  // error callback
                  alert("no file page");
                });
            },
             submitForm(formName) {
              this.$refs[formName].validate((valid) => {
                if (valid) {
                  alert('submit!');
                } else {
                  console.log('error submit!!');
                  return false;
                }
              });
            }

        }
    }
</script>
<style>


</style>